package com.milling.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.milling.common.annotation.Log;
import com.milling.common.core.controller.BaseController;
import com.milling.common.core.domain.AjaxResult;
import com.milling.common.enums.BusinessType;
import com.milling.business.domain.WmsConfigHole;
import com.milling.business.service.IWmsConfigHoleService;
import com.milling.common.utils.poi.ExcelUtil;
import com.milling.common.core.page.TableDataInfo;

/**
 * 配针孔位信息Controller
 *
 * @author X
 * @date 2025-10-14
 */
@RestController
@RequestMapping("/business/wmsConfigHole")
public class WmsConfigHoleController extends BaseController
{
    @Autowired
    private IWmsConfigHoleService wmsConfigHoleService;

    /**
     * 查询配针孔位信息列表
     */
    @PreAuthorize("@ss.hasPermi('business:wmsConfigHole:list')")
    @GetMapping("/list")
    public TableDataInfo list(WmsConfigHole wmsConfigHole)
    {
        startPage();
        List<WmsConfigHole> list = wmsConfigHoleService.selectWmsConfigHoleList(wmsConfigHole);
        return getDataTable(list);
    }

    /**
     * 导出配针孔位信息列表
     */
    @PreAuthorize("@ss.hasPermi('business:wmsConfigHole:export')")
    @Log(title = "配针孔位信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsConfigHole wmsConfigHole)
    {
        List<WmsConfigHole> list = wmsConfigHoleService.selectWmsConfigHoleList(wmsConfigHole);
        ExcelUtil<WmsConfigHole> util = new ExcelUtil<WmsConfigHole>(WmsConfigHole.class);
        util.exportExcel(response, list, "配针孔位信息数据");
    }

    /**
     * 获取配针孔位信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:wmsConfigHole:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(wmsConfigHoleService.selectWmsConfigHoleById(id));
    }

    /**
     * 新增配针孔位信息
     */
    @PreAuthorize("@ss.hasPermi('business:wmsConfigHole:add')")
    @Log(title = "配针孔位信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WmsConfigHole wmsConfigHole)
    {
        return toAjax(wmsConfigHoleService.insertWmsConfigHole(wmsConfigHole));
    }

    /**
     * 修改配针孔位信息
     */
    @PreAuthorize("@ss.hasPermi('business:wmsConfigHole:edit')")
    @Log(title = "配针孔位信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WmsConfigHole wmsConfigHole)
    {
        return toAjax(wmsConfigHoleService.updateWmsConfigHole(wmsConfigHole));
    }

    /**
     * 删除配针孔位信息
     */
    @PreAuthorize("@ss.hasPermi('business:wmsConfigHole:remove')")
    @Log(title = "配针孔位信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsConfigHoleService.deleteWmsConfigHoleByIds(ids));
    }
}
